using System;
using System.Collections.Generic;
using System.Text;
using Castle.ActiveRecord;

namespace ElevatorSpeeches.Framework
{
    [ActiveRecord]
    [Serializable]
    public class Speech : EntityBase<Speech>
    {        
        [Property]
        public string Body {get; set;}
                
        [Property(ColumnType="StringClob")]
        public string ExtendedBody {get; set;}
        
        [BelongsTo("UserID")] 
        public User User {get; set;}

        [BelongsTo("SpeechTopicID")]
        public SpeechTopic Topic {get; set;}

        [Property]
        public DateTime CreateDate { get; set; }

        public override void Save()
        {
            if (CreateDate == DateTime.MinValue)
                CreateDate = DateTime.Now;
            base.Save();
        }
    }
}
